<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button>发送请求</button>
    <button>取消请求</button>
</body>
<script type="module">
    const btns = document.querySelectorAll('button');
    let xhr;
    btns[0].onclick = function (){
        btns[1].click();
        xhr = new XMLHttpRequest();
        xhr.responseType='json';
        xhr.open('get','http://192.168.137.1.com/scoreList');
        xhr.send();
        xhr.onload = function(){
            console.log(xhr.response);
        }
        xhr.onabort = function(){
            console.log('取消请求')
        }
    }
    btns[1].onclick = function(){
        if(xhr) xhr.abort();
    }
</script>
</html>